web/src/pages/[...listing].astro
606 lines · 16427 bytes
1---
2
3import Layout from '@layouts/Layout.astro';
4import ServiceList from '@components/things/ServiceList.astro';
5import Comments from '@components/things/Comments.svelte';
6import GitHubDetailedInfo from '@components/things/GitHubDetailedInfo.astro';
7import PrivacyPolicyDetails from '@components/things/PrivacyPolicyDetails.astro';
8import WebsiteDetailedInfo from '@components/things/WebsiteDetailedInfo.astro';
9import DockerDetailedInfo from '@components/things/DockerDetailedInfo.astro';
10import SocialShare from '@components/form/Social.astro';
11import DataActions from '@components/things/DataActions.svelte';
12import type { AwesomePrivacy, Section, Service } from '../types/Service';
13import { fetchData, slugify } from '@utils/fetch-data';
14import { fetchGitHubStats } from '@utils/fetch-repo-info';
15import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
16import { fetchWebsiteInfo } from '@utils/fetch-website-info';
17import { fetchDockerData } from '@utils/fetch-docker-instructions';
18import { parseMarkdown, formatLink } from '@utils/parse-markdown';
19import { site } from '@utils/config';
20import FontAwesome from '@components/form/FontAwesome.svelte';
21import Button from '@components/form/Button.astro';
22
23interface Props extends Service {
24 slug: string;
25 parentSection: Section;
26 categoryName: string;
27}
28
29const {
30 name,
31 description,
32 url,
33 github,
34 tosdrId,
35 icon,
36 followWith,
37 securityAudited,
38 openSource,
39 acceptsCrypto,
40 parentSection,
41 categoryName,
42} = Astro.props;
43
44
45/**
46 * Make a list of keywords, for the <meta keywords> tag
47 */
48const makeKeyWordTag = () => {
49 const keywords: string[] = [];
50 keywords.push(`open source ${parentSection.name}`);
51 keywords.push(`${parentSection.name} comparison`);
52 (parentSection.alternativeTo || []).forEach((alt: string) => {
53 keywords.push(`${alt} alternative`);
54 });
55 (parentSection.services || []).forEach((serv: Service) => {
56 keywords.push(`${serv.name} vs`);
57 });
58 keywords.push('private');
59 keywords.push('ad free');
60 keywords.push('encrypted');
61 keywords.push('open source software');
62 keywords.push('privacy respecting apps');
63 keywords.push('free tools');
64 return keywords.join(', ');
65};
66
67/**
68 * Make a page title
69 */
70const makePageTitle = () => {
71 return `${name} | ${parentSection.name} | ${categoryName} | Awesome Privacy`;
72};
73
74/**
75 * Make a string page intro, for the description tag
76 */
77const makeDescriptionTag = () => {
78 let description = `Analysis of ${name}, and other privacy-respecting ${parentSection.name} `;
79 if (parentSection.services) {
80 const serviceList = parentSection.services.map((serv: Service) => serv.name);
81 description += `Compare ${serviceList.join(' vs ')} more apps. `
82 }
83 if (parentSection.alternativeTo && parentSection.alternativeTo.length > 0) {
84 description += `The best secure encrypted alternatives to ${parentSection.alternativeTo.join(', ')} in 2024. `;
85 }
86 description += 'All this, and many more free and awesome tools and software.'
87 return description;
88};
89
90// Return a list of Services, except for the currtent one
91const filterServices = () => {
92 return parentSection.services.filter((service: Service) => service.name !== name);
93};
94
95export async function getStaticPaths() {
96 const pages = await fetchData().then((data) => {
97 const results: Array<Props> = [];
98 if (!data || !data.categories) return results;
99 (data as AwesomePrivacy).categories.forEach((category) => {
100 category.sections.forEach((section) => {
101 const services = (section.services || []).map((service) => {
102 return {
103 slug: `${slugify(category.name)}/${slugify(section.name)}/${slugify(service.name)}`,
104 parentSection: section,
105 categoryName: category.name,
106 ...service,
107 };
108 });
109 results.push(...services);
110 });
111
112 });
113 return results;
114 });
115
116 return pages.map((props: Props) => {
117 return {params: { listing: props.slug }, props };
118 });
119}
120
121const makePaginationLinks = () => {
122 const allServices = parentSection.services || [];
123 const index = allServices.findIndex(item => item.name === name);
124 const previousItem = index > 0 ? allServices[index - 1].name : null;
125 const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null;
126 return { previous: previousItem, next: nextItem };
127};
128
129const { previous, next } = makePaginationLinks();
130
131
132const ignoredSites = ['github.gom', 'wikipedia.'];
133
134// Fetch detailed data about the services GitHub repo, privacy policy and website
135const githubData = github ? await fetchGitHubStats(github) : null;
136const privacyData = tosdrId ? await fetchTosdrPrivacy(tosdrId) : null;
137const dockerData = await fetchDockerData(name);
138const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignoredSite))) ? await fetchWebsiteInfo(url) : null;
139
140const getApiEndpoint = () => {
141 return `https://api.awesome-privacy.xyz/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`;
142}
143
144---
145
146<Layout title={makePageTitle()} keywords={makeKeyWordTag()} description={makeDescriptionTag()} >
147 <main>
148 <section>
149 <div class="service-head">
150 <h2>{name}</h2>
151 <span class="url-wrap">
152 <a class="service-url" href={url}>{formatLink(url)}</a>
153 <span class="follow-with">{followWith}</span>
154 </span>
155 </div>
156 <div class="breadcrumbs">
157 <span>
158 <a href="/">Awesome Privacy</a>
159 ➔ <a href={`/${slugify(categoryName)}`}>{categoryName}</a>
160 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}>{parentSection.name}</a>
161 ➔ <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)}`}>{name}</a>
162 </span>
163 </div>
164 <div class="intro">
165 <img
166 width="60"
167 height="60"
168 loading="lazy"
169 decoding="async"
170 class="service-icon"
171 alt={`${name} Icon`}
172 data-service-url={formatLink(url)}
173 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
174 />
175 <div>
176 <p class="description" set:html={parseMarkdown(description)}></p>
177 <ul>
178 { url && (
179 <li>
180 <b>Homepage:</b>
181 <a href={url}>{formatLink(url)}</a>
182 </li>
183 )}
184 { github && (
185 <li>
186 <b>GitHub:</b>
187 <a href={`https://github.com/${github}`}>github.com/{github}</a>
188 </li>
189 )}
190 { tosdrId && (
191 <li>
192 <b>Privacy:</b>
193 <a href={`https://tosdr.org/en/service/${tosdrId}`}>{`tosdr.org/en/service/${tosdrId}`}</a>
194 </li>
195 )}
196 { url && (
197 <li>
198 <b>Web info:</b>
199 <a href={`https://web-check.xyz/results/${formatLink(url)}`}>{`web-check.xyz/results/${formatLink(url).split('/')[0]}`}</a>
200 </li>
201 )}
202 </ul>
203 </div>
204 </div>
205 <div class="highlights">
206 { securityAudited && (
207 <span class="meta-item great" title={`${name} has been security audited by an accredited auditor, with results published publicly`}>
208 <FontAwesome iconName="securityAudited" /> Security Audited
209 </span>
210 )}
211 { acceptsCrypto && (
212 <span class="meta-item great" title={`${name} accepts anonymous payment methods`}>
213 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
214 </span>
215 )}
216 { securityAudited === false && (
217 <span class="meta-item warning" title={`${name} has not been audited`}>
218 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
219 </span>
220 )}
221 { (openSource === false) && (
222 <span class="warning">
223 <FontAwesome iconName="closedSource" />
224 Not Open Source
225 </span>
226 )}
227 { openSource || (github && openSource !== false) ? (
228 <span class="meta-item great" title={`${name} is open source`}>
229 <FontAwesome iconName="openSource" /> Open Source
230 </span>
231 ) : null }
232 </div>
233 </section>
234 { privacyData && (
235 <section>
236 <h3>{name} Privacy Policy</h3>
237 <PrivacyPolicyDetails privacyData={privacyData} />
238 </section>
239 )}
240 { github && githubData && (
241 <section class="github-wrap">
242 <h3>{name} Source Code</h3>
243 <GitHubDetailedInfo gitHubData={githubData} repo={github} />
244 </section>
245 )}
246
247 { websiteData && (
248 <section>
249 <h3>{name} Website</h3>
250 <WebsiteDetailedInfo url={url} websiteInfo={websiteData} />
251 </section>
252 )}
253 { dockerData && dockerData.found && (
254 <section>
255 <h3>{name} Docker</h3>
256 <DockerDetailedInfo docker={dockerData} />
257 </section>
258 )}
259
260 <section>
261 <h3>{name} Reviews</h3>
262 <Comments client:visible />
263 </section>
264
265 <section>
266 <h3>More {parentSection.name}</h3>
267 <ServiceList
268 services={filterServices()}
269 subHeading={true}
270 noGitHubMetrics={true}
271 buttonLink={`/${slugify(categoryName)}/${slugify(parentSection.name)}`}
272 categoryName={categoryName}
273 sectionName={parentSection.name}
274 />
275 </section>
276 <section>
277 <h3>About the Data: {name}</h3>
278 <DataActions client:load categoryName={categoryName} sectionName={parentSection.name} serviceName={name} />
279 <h4>API</h4>
280 <p>
281 You can access {name}'s data programmatically via our API.
282 Simply make a <code>GET</code> request to:
283 </p>
284 <pre><a href={getApiEndpoint()}><code>{getApiEndpoint()}</code></a></pre>
285 <p>
286 The REST API is free, no-auth and CORS-enabled.
287 To learn more, view the <a href="/api">Swagger Docs</a> or read the <a href="/about#api">API Usage Guide</a>.
288 </p>
289
290 <h4>About the Data</h4>
291 <p>
292 Beyond the user-submitted YAML you see above, we also augment each listing with
293 additional data dynamically fetched from several sources.
294 To learn more about where the rest of data included in this page comes from,
295 and how it is computed,
296 see the <a href="/about#our-data">About the Data</a> section of our About page.
297 </p>
298 </section>
299
300 <section>
301 <h3>Share {name}</h3>
302 <p>
303 Help your friends compare {parentSection.name}, and pick privacy-respecting software and services.<br />
304 Share {name} and Awesome Privacy with your network!
305 <div>
306 <SocialShare
307 url={`${site}/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(name)} `}
308 title={`Checkout ${name}! \n`}
309 description={
310 `Compare #${name} and other privacy-respecting ${parentSection.name} at `
311 + `Awesome-Privacy.xyz, the free and open source list of private software alternatives. `
312 + `#privacy #opensource #awesomeprivacy by @Lissy_Sykes`}
313 />
314 </div>
315 </p>
316 </section>
317
318 <div class="pagination-navigation">
319 { previous ? (
320 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}>
321 <span>← Previous</span>
322 <p>{previous}</p>
323 </Button>
324 ) : <p class="nothing"></p>}
325 <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`} class="go-to-category">
326 View {parentSection.name} ({(parentSection.services || []).length})
327 </a>
328 { next && (
329 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}>
330 <span>Next →</span>
331 <p>{next}</p>
332 </Button>
333 )}
334 </div>
335 </main>
336</Layout>
337
338<style lang="scss">
339
340main {
341 margin: 2rem auto;
342 padding: 1rem;
343 width: 1000px;
344 max-width: calc(100% - 5rem);
345 position: relative;
346 @media(max-width: 768px) {
347 max-width: 95%;
348 padding: 0.5rem;
349 margin: 0 auto;
350 }
351}
352
353section {
354 margin: 1rem 0 4rem 0;
355 padding: 1rem;
356 min-height: 8rem;
357 position: relative;
358 border: 2px solid var(--foreground);
359 box-shadow: 6px 6px 0 var(--foreground);
360 background: var(--accent-fg);
361
362}
363
364p {
365 margin: 0.25rem 0 0.5rem 0;
366}
367
368h3 {
369 font-size: 2rem;
370 margin: -2rem 0 1rem -2rem;
371 box-shadow: 6px 6px 0 var(--foreground);
372 background: var(--accent);
373 color: var(--accent-fg);
374 width: fit-content;
375 padding: 0.25rem 0.5rem;
376 @media(max-width: 768px) {
377 margin: -2rem auto 2rem auto;
378 }
379 }
380
381.service-head {
382 h2 {
383 font-size: 3rem;
384 margin: 0;
385 @media(max-width: 768px) {
386 text-align: center;
387 }
388 }
389 .url-wrap {
390 display: flex;
391 align-items: center;
392 gap: 0.5rem;
393 a {
394 font-size: 1.2rem;
395 }
396 .follow-with {
397 font-style: italic;
398 opacity: 0.6;
399 }
400 @media(max-width: 768px) {
401 flex-direction: column;
402 }
403 }
404
405}
406
407.breadcrumbs {
408 opacity: 0.5;
409 font-size: 0.8rem;
410 position: absolute;
411 right: 1rem;
412 top: 1rem;
413 a {
414 color: var(--foreground);
415 transition: all 0.15s ease-in-out;
416
417 &:hover {
418 color: var(--accent);
419 }
420 }
421 @media(max-width: 768px) {
422 display: none;
423 }
424}
425
426h4 {
427 font-size: 1.4rem;
428 margin-bottom: 0;
429}
430
431.intro {
432 font-size: 1.2rem;
433 font-style: italic;
434 opacity: 0.9;
435 display: flex;
436 gap: 0.5rem;
437 @media(max-width: 768px) {
438 flex-direction: column;
439 }
440 .service-icon {
441 border-radius: var(--curve-md);
442 margin-top: 1rem;
443 @media(max-width: 768px) {
444 margin: 1rem auto 0 auto;
445 }
446 }
447 ul {
448 padding-left: 1rem;
449 list-style: circle;
450 font-style: normal;
451 font-size: 1rem;
452 margin-top: 0;
453 b {
454 font-size: 1rem;
455 font-weight: 400;
456 min-width: 85px;
457 display: inline-block;
458 @media(max-width: 768px) {
459 width: auto;
460 display: block;
461 }
462 }
463 }
464}
465
466.pagination-navigation {
467 display: flex;
468 justify-content: space-between;
469 align-items: center;
470 padding: 1rem 0;
471 :global(.button) {
472 min-width: 120px;
473 width: fit-content;
474 padding: 0.25rem 1rem;
475 text-align: right;
476 &:first-child { text-align: left; }
477 p {
478 margin: 0;
479 font-weight: normal;
480 font-size: 1rem;
481 }
482 span {
483 font-size: 0.8rem;
484 }
485
486 }
487 .nothing {
488 width: 120px;
489 }
490 .go-to-category {
491 color: var(--foreground);
492 font-size: 0.8rem;
493 opacity: 0.5;
494 @media (max-width: 768px) {
495 display: none;
496 }
497 }
498}
499
500
501
502.further-info, .notable-mentions, .word-of-warning {
503 h3 {
504 font-size: 1.4rem;
505 margin: 1rem 0;
506 }
507 :global(p) {
508 font-size: 0.9rem;
509 opacity: 0.7;
510 :global(strong) {
511 font-weight: 500;
512 }
513 :global(a) {
514 color: var(--foreground);
515 transition: all 0.15s ease-in-out;
516 &:hover {
517 color: var(--accent);
518 }
519 }
520 }
521 :global(strong) {
522 font-weight: 500;
523 }
524 :global(h4) {
525 font-size: 1.2rem;
526 margin: 0.5rem 0 0 0;
527 }
528 :global(ul) {
529 list-style: circle;
530 padding-left: 1rem;
531 font-size: 0.9rem;
532 opacity: 0.7;
533 li {
534 margin-bottom: 0.25rem;
535 :global(p) {
536 display: inline;
537 }
538 }
539 }
540}
541
542pre {
543 a {
544 text-decoration: none;
545 color: var(--foreground);
546 code {
547 background: #acabb782;
548 padding: 0.2rem 0.4rem;
549 border-radius: var(--curve-sm);
550 font-family: Courier New;
551 font-size: 0.9rem;
552 @media(max-width: 768px) {
553 white-space: break-spaces;
554 }
555 }
556 }
557}
558
559.highlights {
560 display: flex;
561 gap: 1rem;
562 flex-wrap: wrap;
563 align-items: center;
564 justify-content: end;
565
566 .meta-item, .warning {
567 display: flex;
568 align-items: center;
569 // justify-content: center;
570 gap: 0.25rem;
571 opacity: 0.6;
572 font-size: 0.9rem;
573 padding: 0.5rem 0;
574 :global(svg) {
575 color: var(--foreground);
576 width: 1.2rem;
577 height: 1.2rem;
578 }
579 a {
580 text-decoration: none;
581 color: var(--foreground);
582 display: flex;
583 gap: 0.25rem;
584 &:hover {
585 color: var(--accent-3);
586 :global(svg) {
587 color: var(--accent-3);
588 }
589 }
590 }
591 }
592 .warning {
593 color: var(--danger);
594 :global(svg) {
595 color: var(--danger);
596 }
597 }
598 .great {
599 color: #007930; // var(--success);
600 :global(svg) {
601 color: #007930; // var(--success);
602 }
603 }
604}
605
606</style>